<template>
  <div class="app-container">
    <div class="page-filter mb10 fl">
      <el-form ref="filter" :model="filter" label-width="0">
        <el-form-item class="mr10 mb5 fl">
          <ProSelect v-model="filter.pro_id" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <StaffSelect v-model="filter.head_id" placeholder="请选择负责人" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <StaffSelect v-model="filter.su_id" placeholder="请选择填写人" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" prop="create_time">
          <el-date-picker
            v-model="filter.create_time"
            placeholder="填表日期"
            type="date"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            size="small"
            clearable
            style="width: 100%"
          />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" style="width: 300px">
          <el-button size="small" @click="app.resetFields($refs['filter'].$parent,'filter')">清 空</el-button>
          <el-button type="primary" size="small" @click="getList">查 询</el-button>
          <el-button
            type="primary"
            size="small"
            @click="handleDialog({
              dTitle: '新增日报',
              dType: 'add',
              dField: dField
            })"
          >新 增</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table v-loading="app.loading" class="search-table" :data="list" border fit highlight-current-row style="width: 100%;">
      <el-table-column label="序号" align="center" width="56px">
        <template slot-scope="{$index}">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column label="工程名称" min-width="220px" prop="pro_name"/>
      <el-table-column label="PO单号" width="190px">
        <template slot-scope="{row}">
          {{ 'PO'+row.pro_id }}
        </template>
      </el-table-column>
      <el-table-column label="施工班组" width="160px" prop="team" />
      <el-table-column label="工程地点" width="260px" prop="addr" />
      <el-table-column label="计划开工时间" align="center" width="130px" prop="plan_start_time" />
      <el-table-column label="计划完工时间" align="center" width="130px" prop="plan_complete_time" />
      <el-table-column label="班组负责人" width="110px" prop="head_name" />
      <el-table-column label="填表人" width="110px" prop="nickname" />
      <el-table-column label="填表日期" align="center" width="130px" prop="create_time" />
      <el-table-column label="天气情况" width="90px" prop="weather" />
      <el-table-column label="最低/最高气温" width="120px" prop="temperature" />
      <el-table-column label="人员进场情况" min-width="260px" prop="personnel_situation" />
      <el-table-column label="材料及机械设备情况" min-width="260px" prop="device_material" />
      <el-table-column label="操作" align="center" width="90px" fixed="right">
        <template slot-scope="{row}">
          <el-dropdown>
            <el-button type="primary" size="mini">
              操作<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                @click.native="handleDialog({...row, ...
                {dTitle: '编辑日报', dType: 'edit', dField: dField}})"
              >
                编 辑
              </el-dropdown-item>
              <el-dropdown-item @click.native="handleDelete(row)">删 除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="filter.pageAll>0" :total="filter.pageAll" :page.sync="filter.pageCurrent" :limit.sync="filter.pageNumber" @pagination="getList" />
    <Dialog ref="dialog" :get-data="getList" :info="dialog" />
    <Cos ref="cos" :info="dialog" />
  </div>
</template>

<script>
import { days, delDay } from '@/api/report/report'
import Dialog from './components/day-dialog'
import page from '@/utils/page'
import StaffSelect from '@/myComponents/StaffSelect'
import ProSelect from '@/components/ProSelect'

export default {
  name: '',
  components: { Dialog, StaffSelect, ProSelect },
  extends: page,
  props: {
    reqList: {
      default: days,
      type: Function
    },
    reqDel: {
      default: delDay,
      type: Function
    }
  },
  data() {
    return {
      dField: ['id', 'pro_id', 'team', 'addr', 'plan_start_time', 'plan_complete_time', 'head_id', 'su_id', 'weather', 
      'temperature', 'personnel_situation', 'device_material', 'measure', 
      'quality_acceptance', 'safe_civilized', 'coordinate', 'other', 'create_time']
    }
  },
  created() {
    this.getList()
  },
  methods: {
  }
}
</script>
